package com.hfdg.prototype.base.configuration;

import io.minio.MinioClient;
import io.minio.errors.InvalidEndpointException;
import io.minio.errors.InvalidPortException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName MinioConfiguration
 * @Description TODO
 * @Author yuelh
 * @Date 2020-7-31 16:45
 * @Version 1.0
 * @Company 会飞的锅工作室
 **/
@Configuration
@EnableConfigurationProperties(MinioPropereties.class)
public class MinioConfiguration {
    @Autowired
    private MinioPropereties minioPropereties;


    @Bean
    public MinioClient minioClient() throws InvalidPortException, InvalidEndpointException {
        MinioClient minioClient = new MinioClient(minioPropereties.getEndpoint(),minioPropereties.getAccessKey(),minioPropereties.getAccessKey());
        return minioClient;
    }

}
